package com.future.hedongjun.mall.bean;

import com.future.baselib.entity.BaseResponse;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jniu
 * @Email niuxiaoqi@hztianque.com
 * @time 2018/12/23
 */
public class MallTypeResponse extends BaseResponse{

    public List<MallType> data;

    @Override
    public void parseInfo(String content) throws JSONException {
        JSONArray array = new JSONArray(content);
        data = new ArrayList<>();
        for (int i = 0; i < array.length(); i++) {
            JSONObject object = array.optJSONObject(i);
            MallType type = new MallType();
            type.id = object.optString("id");
            type.name = object.optString("name");
            data.add(type);
        }
    }
}
